import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/router'
import ajax from './config/ajax'
import './style/common'
import './config/rem'

Vue.directive('tap', {
    bind: function(el, binding) {
        var startTx, startTy, endTx, endTy;
        el.addEventListener("touchstart", function(e) {
            var touch = e.touches[0];
            startTx = touch.clientX;
            startTy = touch.clientY;
            el.addEventListener("touchend", function(e) {
                var touch = e.changedTouches[0];
                endTx = touch.clientX;
                endTy = touch.clientY;
                if (Math.abs(startTx - endTx) < 6 && Math.abs(startTy - endTy) < 6) {
                    var method = binding.value.method;
                    var params = binding.value.params;
                    method(params);
                }
            }, false);
        }, false);

    }
})

Vue.use(VueRouter)
const router = new VueRouter({
    routes
})

new Vue({
    router
}).$mount('#app')